<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld"  prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld"  prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/custom-html.tld" prefix="chtml" %>

<%@ page  import="java.util.*" %>
<%@ page  import="com.erp.framework.util.CommonUtil" %>
<%@ page  import="com.erp.app.common.ProjectConstants" %>
<%@ page  import="org.apache.commons.beanutils.*" %>
<%@ page  import="com.erp.common.web.*" %>

<jsp:useBean id="popUpForm" scope="session" type="com.erp.common.web.PopUpForm" />

<head>
<title>Enquiry</title>
<link rel="stylesheet" href="<%=request.getContextPath()+ "/css/style.css" %>" type="text/css">
<link rel="stylesheet" href="<%=request.getContextPath()+ "/popcalendar/popcalendar.css" %>" type="text/css">

<script language="javascript" src="<%=request.getContextPath()+ "/js/confirmMsg.js" %>"></script>
<script language="javascript" src="<%=request.getContextPath()+ "/js/sys.js" %>"></script>
<script language="javascript" src="<%=request.getContextPath()+ "/js/menu-sys.js" %>"></script>
<script language="vbscript" src="<%=request.getContextPath()+ "/vbs/confirmMsg.vbs" %>"></script>

<script language="javascript">
<!--

function doLoad() {	
	window.moveTo(0, 0);
}

-->
</script>
</head>


<%
int noOfItemsPerLine = 2;
HashMap params = popUpForm.getParams();

String title = (String)params.get(ProjectConstants.SESSION_POP_UP_PARAMS_TITLE);
ArrayList hdrLabelList = (ArrayList)params.get(ProjectConstants.SESSION_POP_UP_PARAMS_HEADER_LABEL_LIST);
ArrayList hdrValueList = (ArrayList)params.get(ProjectConstants.SESSION_POP_UP_PARAMS_HEADER_VALUE_LIST);
ArrayList dtlLabelList = (ArrayList)params.get(ProjectConstants.SESSION_POP_UP_PARAMS_DTL_LABEL_LIST);
ArrayList dtlValueList = (ArrayList)params.get(ProjectConstants.SESSION_POP_UP_PARAMS_DTL_VALUE_LIST);
%>

<body onLoad="javascript:doLoad();" bgcolor="#FFFFFF">

<html:form action="/popUp">
<html:hidden property="pageEvent" />
<html:hidden property="pageMode" />

<table class="table_header">
	<tr colspan="<%=noOfItemsPerLine*2%>">
		<td class="txtTitle" background="images/title_bg.gif" colspan="<%=noOfItemsPerLine*2%>">
			&nbsp;<%=title%>
		</td>
	</tr>

	<tr colspan="<%=noOfItemsPerLine*2%>">
		<td colspan="<%=noOfItemsPerLine*2%>">
			&nbsp;
		</td>
	</tr>

	<%int j = 0;%>
	<% for (int i = 0; (hdrLabelList != null) && (i < hdrLabelList.size()); i++) { %>
		<%
		if (j%noOfItemsPerLine == 0) {
			out.println("<tr>");
		}
		%>
		<td class="col_label" width=100>
			<%=hdrLabelList.get(i)%>
		</td>
		<td class="col_value" width=200>
			<%=hdrValueList.get(i)%>
		</td>
		<% if (j%noOfItemsPerLine == (noOfItemsPerLine-1)) {
			out.println("</tr>");
		}
		j++;
		%>	
	<% } %>
</table>

<br>

<% if ( (dtlValueList != null) && (dtlValueList.size() > 0) ) { %>
	<table class="table_grid">
		<tr class="grid_header">
		<% for (int i = 0; (dtlLabelList != null) && (i < dtlLabelList.size()); i++) { %>		
			<td class="grid_header_col" width=100>
				<%=dtlLabelList.get(i)%>
			</td>		
		<% } %>
		</tr>

		<% 
		for (int i = 0; (dtlValueList != null) && (i < dtlValueList.size()); i++) {
			ArrayList rowList = (ArrayList)dtlValueList.get(i);
		%>
		<tr <%=(i%2 == 0)? "class='grid_result1'": "class='grid_result2'"%>>	
		<%
			for (int k = 0; (rowList != null) && (k < rowList.size()); k++) {
		%>
			<td>
				<%=CommonUtil.nullToString(rowList.get(k))%>
			</td>		
		<%
			}
		%>
		</tr>
		<% } %>
	</table>
<% } %>

<br>
	<input type="button" value="  OK  " class="button1" onClick="javascript:self.close();">

</html:form>
</body>